package cn.tedu.jdbc;

import java.lang.reflect.Constructor;


public class Test {
    public static void main(String[] args) throws Exception {
        Class<Person> c=Person.class;
        Constructor declaredConstructor = c.getDeclaredConstructor(int.class,String.class);
        declaredConstructor.setAccessible(true);
        Object o = declaredConstructor.newInstance(12,"张三");
        Person person=(Person) o;



    }
}
class Person{
    private Person() {
    }


    int age;
    String name;

    private Person(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}



